package org.example.controller;

import cn.lingyangwl.framework.core.response.Resp;
import lombok.Getter;
import lombok.Setter;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/**
 * @author shenguangyang
 */
@CrossOrigin
@RestController
@RequestMapping("/sign")
public class TestSignatureController {
//    @Resource
//    private SignatureProperties signatureProperties;

    @Getter
    @Setter
    public static class T02 {
        private BigDecimal money;
        private String bankCard;
    }

//    @ApiSignature
    @GetMapping("/t01")
    public Resp<BigDecimal> t01(@RequestParam BigDecimal money) {
        return Resp.ok(money);
    }

//    @ApiSignature
    @PostMapping("/t02")
    public Resp<T02> t02(@RequestBody T02 t02) {
        return Resp.ok(t02);
    }

    /**
     * 获取公钥和私钥
     */
    @GetMapping
    public Resp<Map<String, String>> getKey() {
        Map<String, String> resp = new HashMap<>();
//        resp.put("privateKey", signatureProperties.getAsymmetricCrypto().getPrivateKey());
//        resp.put("publicKey", signatureProperties.getAsymmetricCrypto().getPublicKey());
        return Resp.ok(resp);
    }
}
